package com.hypo.feign.controller;

import com.hypo.feign.TestClientInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: haibo.tang2
 * @Date: 2021/8/13
 * @Description:
 **/
@RestController
@RequestMapping("/test")
public class TestServerController {


    @Resource
    private TestClientInterface testClientInterface;

    @Autowired
    private DiscoveryClient discoveryClient;

    @RequestMapping("/getPort")
    public String getPort() {
        List<String> services =
                discoveryClient.getServices();
        System.out.println(services);
        return testClientInterface.getPort();
    }
}
